package com.probiz.estoresf.sociallogin.web.action;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONObject;
import org.springframework.web.servlet.ModelAndView;

import cc.denglu.sdk.Denglu;
import cc.denglu.sdk.DengluException;

import com.probiz.estore.core.controller.BaseController;

public class LoginTokenController extends BaseController {
	public ModelAndView defaultAction(HttpServletRequest request,HttpServletResponse response) throws ServletException {
		String token = request.getParameter("token");
		Denglu denglu;
		try {
			denglu = new Denglu("29927denQyOLviVEUeCs0Wst2joSO5","$1$37704den$pgktW.fbhOnbHul.K.1jv0","MD5");
			JSONObject userInfo = denglu.getUserInfoByToken(token);
			logger.info(token);
			logger.info(userInfo);
		} catch (DengluException e) {
			e.printStackTrace();
		}
		return getModelAndView("sociallogin/tokenUrl", null);
	}
}
